Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: VSin, ISin Sources added to Maxwell Circuit Primitives #5283

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

DaveTwyman
Copy link
Contributor

Create Page and Select Page added to Circuit Primitives

Create Page and Select Page added to Circuit Primitives
@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@DaveTwyman DaveTwyman changed the title VSin, ISin Sources added to Maxwell Circuit Primitives FEAT: VSin, ISin Sources added to Maxwell Circuit Primitives Oct 11, 2024
Copy link

codecov bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 8.33333% with 44 lines in your changes missing coverage. Please review.

Project coverage is 40.52%. Comparing base (25c9ca1) to head (d44fd5d).

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5283       +/-   ##
===========================================
- Coverage   84.33%   40.52%   -43.82%     
===========================================
  Files         140      140               
  Lines       58460    58490       +30     
===========================================
- Hits        49305    23701    -25604     
- Misses       9155    34789    +25634     

DaveTwyman and others added 4 commits October 11, 2024 13:04
Create Page and Select Page added to Circuit Primitives
…s' into 5282-Add-Missing-Circuit-Elements

# Conflicts:
#	src/ansys/aedt/core/modeler/circuits/primitives_circuit.py
Create Page and Select Page added to Circuit Primitives
@gmalinve gmalinve marked this pull request as draft October 11, 2024 12:53
Copy link
Collaborator

@SMoraisAnsys SMoraisAnsys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes, could you address the comments and add tests ?

@gmalinve
Copy link
Contributor

gmalinve commented Oct 14, 2024

@DaveTwyman please install pre-commit in your venv because I see that every time you push a commit it automatically triggers the auto fixes pre-commit:
image
This package will automatically run all the checks specified in .pre-commit-config.yaml when you push a commit.

Also remember to update and merge main in your branch from time to time.

@DaveTwyman
Copy link
Contributor Author

@DaveTwyman please install pre-commit in your venv because I see that every time you push a commit it automatically triggers the auto fixes pre-commit: image This package will automatically run all the checks specified in .pre-commit-config.yaml when you push a commit.

Also remember to update and merge main in your branch from time to time.

@gmalinve Good point about the pre-commit, I see it's installed on my machine. I've just updated it too. I guess the issue is I need to start using it before each push.

I believe I'm updating main before each push from PyCharm, but let me know if you can see evidence something is wrong here. Thanks again as always

@DaveTwyman DaveTwyman marked this pull request as ready for review October 14, 2024 10:47
@SMoraisAnsys
Copy link
Collaborator

@DaveTwyman If it is installed on your machine then it shouldn't let you commit. The precommit should trigger the problems locally before allowing you to make any commit.

@DaveTwyman
Copy link
Contributor Author

@DaveTwyman If it is installed on your machine then it shouldn't let you commit. The precommit should trigger the problems locally before allowing you to make any commit.

Ok, understood, I'm just reading up on how to set this up now

@gmalinve
Copy link
Contributor

@DaveTwyman you need to add unit tests now :)

@gmalinve gmalinve marked this pull request as draft October 16, 2024 15:00
@DaveTwyman DaveTwyman marked this pull request as ready for review October 17, 2024 09:57
@gmalinve gmalinve marked this pull request as draft October 17, 2024 11:33
use_instance_id_netlist=use_instance_id_netlist,
)

id.set_property("Ia", value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaveTwyman this is not correct, please debug and see what happens when you set a property that doesn't exist. You access "Ia" through parameters. you don't have to use set_property.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gmalinve, I just double checked and this works, I couldn't get a bug to appear.
Ia is one of the ten parameters that ISin can take and the most used parameter (it's the amplitude of the sinusoidal current), it's fed into PyAEDT 'create_isin' using the 'value' parameter. I did think of renaming 'value' to something like 'IPeak', 'Current' etc but since the rest of the Maxwell circuit components in the library have a 'value' parameter I've stuck with using 'value' for consistency. The usage of '.set_property' is throughout the rest of the 'primitives_maxwell_circuit' .
Were you suggesting another approach to 'set_property' that has some advantages?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaveTwyman this is not a bug. You simply have to access the property and change its value through the "parameters" property, without using the set_property method.

Copy link
Contributor Author

@DaveTwyman DaveTwyman Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gmalinve , Sorry I'm not following this, could you tell me what you would replace line 326 with and why?
All the other circuit components in the library use this "set_property" approach

@gmalinve
Copy link
Contributor

@DaveTwyman also please link your issue to this PR so once this is closed they both will be.

@DaveTwyman DaveTwyman linked an issue Oct 17, 2024 that may be closed by this pull request
Renamed create_vsin and create_isin to create_v_sin and create_i_sin
Copy link
Collaborator

@SMoraisAnsys SMoraisAnsys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please use component as variable name instead of comp_name ? This could be confusing for future maintenance as it gives the impression that the variable is a string when it is not.
Also can you add a test for create_page ?

Thanks again for taking the time to perform all the requested changes.

@DaveTwyman
Copy link
Contributor Author

Could you please use component as variable name instead of comp_name ? This could be confusing for future maintenance as it gives the impression that the variable is a string when it is not. Also can you add a test for create_page ?

Thanks again for taking the time to perform all the requested changes.

@SMoraisAnsys , Not at all, thanks for your patience whilst I work through this.

I could do with some guidance on the unit test for the 'create_page', there is no way to check on the pages name, index or other properties, the underlying IronPython doesn't have such a feature. Are you aware of another instance in PyAEDT where we create something that cannot then be queried. I could then copy that UT. In this case there isn't a useful check that can be added to the UT.

Should we do something like add a dummy UT, that just holds a comment?

DaveTwyman and others added 2 commits October 18, 2024 12:10
…ges. All elements now support names that are Strings, Integers, Floats or left blank as per expected Maxwell circuit schematic usage.
@SMoraisAnsys
Copy link
Collaborator

I went through Circuit help PDF files and you might find something usefull with SelectPage and GetNumPages.

@DaveTwyman
Copy link
Contributor Author

I went through Circuit help PDF files and you might find something usefull with SelectPage and GetNumPages.

Yes!, 'GetNumPages', how did I miss that, Thanks

@SMoraisAnsys
Copy link
Collaborator

Hi @DaveTwyman, could you please add the last changes required for this PR ? :)

@DaveTwyman
Copy link
Contributor Author

DaveTwyman commented Oct 29, 2024 via email

@DaveTwyman DaveTwyman marked this pull request as ready for review October 30, 2024 21:03
@DaveTwyman
Copy link
Contributor Author

Hi @DaveTwyman, could you please add the last changes required for this PR ? :)

Hello @SMoraisAnsys , I've added the last unit test, and method needed to support that test (plus another unit test for the new method). So all the new methods now have supporting unit tests.

It seems that the test coverage codecov is very low, do you think this is because of making multiple single line changes 'id' to 'component' or issues elsewhere?
image

@SMoraisAnsys
Copy link
Collaborator

Try to run your test locally and see if it is correctly covered. It might be a codecov issue (but I doubt about it).
It might be because you are not really going through the lines you expect to go through.
I can't have a look at your PR now and giving general advice so that you can check where the coverage issue comes from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Missing Circuit Elements Needed for ETK
3 participants